<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=8">
<title>门店列表</title>
<link rel="stylesheet" type="text/css"
	href="css/reset.css" />
<link rel="stylesheet" type="text/css"
	href="css/common.css" />
<link rel="stylesheet" type="text/css"
	href="css/thems.css">
<link rel="stylesheet" type="text/css"
	href="css/color.css" />
<link rel="stylesheet" type="text/css"
	href="css/bootStrap.min.css" />

<script type="text/javascript"
	src="js/jquery-3.2.1.js"></script>
		<script type="text/javascript">
			$(function() {
				//自适应屏幕宽度
				window.onresize = function() {
					location = location
				};

				var main_h = $(window).height();
				$('.hy_list').css('height', main_h - 45 + 'px');

				var search_w = $(window).width() - 40;
				$('.search').css('width', search_w + 'px');
				//$('.list_hy').css('width',search_w+'px');
			});
		</script>
		<!--框架高度设置-->
	</head>

	<body>
		<div id="right_ctn ">
			<div class="right_m ">
				<!--会议列表-->
				<div class="hy_list ">
					<div class="box_t ">
						<span class="name ">租车订单</span>
						<!--当前位置-->
						<div class="position ">
							<span class="glyphicon glyphicon-home "></span>
							<a href=" ">首页</a>
						</div>
						<!--当前位置-->
					</div>
					<!--查询-->
					<form action="" class="navbar-form navbar-left" method="post ">
						<div class="input-group ">
							<input type="text " class="form-control storeid shuruid" name="storadeId" id=" " value="" placeholder="请输入订单编号" />
							<span class="input-group-addon ">
						<span class="glyphicon glyphicon-zoom-in chaxun "></span>
							</span>
						</div>
						&nbsp;&nbsp;
						
					</form>
					<div>
						<form action="" class="navbar-form navbar-right" method="post ">
					<select class="form-control testselect "  name="classifyId">
						<option value="0">订单类型</option>
						<option value="1" <#if types=='1'>selected="selected"</#if> >普通车类型</option>
						<option value="2" <#if types=='2'>selected="selected"</#if>>顺风车类型</option>
						
						</select>
						&nbsp;&nbsp;&nbsp;&nbsp;
						
						<div class="input-group">
							<input type="button" class="btn btn-primary qiehuan" name="" id="" value="切换" />&nbsp;&nbsp;&nbsp;&nbsp;
						</div>
						</form>
					</div>
					
					<!--添加 start-->
				
					<!--添加 end-->
					<!--查询-->
					<div class="space_hx ">&nbsp;</div>
					<!--列表-->
					<table class="col-md-11 table table-hover text-center">
						<tr class="bg-hui ">
							<td>编号</td>
							<td>用户姓名</td>
							<td>车辆名字</td>
							<td>取车时间</td>
							<td>还车时间</td>
							<td>实际还车时间</td>
							<td>订单类型</td>
							<td>下单日期</td>
							<td>下单状态</td>
							<td>操作</td>							
						</tr>
						<tbody id="tbodys">
					<#list orderlist.list as lists>
					<tr>
					<td>${lists.orderId} </td>
					<td>${lists.userName}</td>
					<td>${lists.vehicleBrandName}</td>
					<td><#if lists.vehicleTakingTime??>
 							${lists.vehicleTakingTime?string('yyyy-MM-dd')}
 							<#else>
 							
						</#if>
						</td>
					<td><#if lists.returnTime??>
 							${lists.returnTime?string('yyyy-MM-dd')}
						</#if>
						</td>
					<td><#if lists.actualTransferTime??>
 							${lists.actualTransferTime?string('yyyy-MM-dd')}
						</#if>
						</td>
					<td class="orderType"><#if lists.orderType == 1>
 							顺风车
						</#if>
						<#if lists.orderType == 0>
 							普通车
						</#if> 
						
						</td>
					<td>${lists.orderDate?string('yyyy-MM-dd')}</td>
					<td class="valueName">${lists.valueName}</td>
					<td class="storadeId">	<span class="glyphicon glyphicon-edit bianji" data-toggle="modal" data-target=".mymodal" data-backdrop="${lists.orderId}" data-state="${lists.orderType}"></span> &nbsp;
						<a href="javaScript:;"><span class="glyphicon glyphicon-remove color-red "></span></a> 
						<#if lists.carId??><input type="hidden" class="carId" value="${lists.carId}"/></#if>
						</td>
					</tr>
					
					</#list>
					</tbody>
					</table>
					<!--列表-->
					<!--右边底部-->
					<div class="r_foot ">
					<div class="r_foot_m ">
						<!--分页-->
							<div class="page " id="pageI" style="text-align:center">
				<a href="Carrentalorderform?pageNo=1&types=${types}" class="layui-btn "> 首页 </a>
				<#if orderlist.hasPrevPage>
					<a href="Carrentalorderform?pageNo=${orderlist.prevPage }&types=${types}" class="layui-btn layui-btn-xs"> 上页 </a>
				</#if>
				<#list orderlist.groupPage as pageI>
					<a href="Carrentalorderform?pageNo=${pageI}&types=${types}"  style="<#if pageI=orderlist.currentPage >background-color: #0099FF; color: white;border-color:#0099FF;</#if>" class="layui-btn layui-btn-xs " > ${pageI } </a>
				</#list>
				<#if orderlist.hasNextPage>
					<a href="Carrentalorderform?pageNo=${orderlist.nextPage }&types=${types}" class="layui-btn layui-btn-xs"> 下页 </a>
				</#if>
				<a href="Carrentalorderform?pageNo=${orderlist.totalPage }&types=${types}" class="layui-btn "> 末页</a>
			</div>
						<!--分页-->
					</div>
				</div>
					
					</form>
					<!--右边底部-->
				</div>
				<!--会议列表-->
			</div>
		</div>
		<!-- 添加模态框-->
		<div id="modal-add" class="modal fade">
			<div class="modal-dialog modal-lg">
				<div class="modal-content">
					<div class="modal-header">
						<button class="close" data-dismiss="modal">&times;</button>
						<!--head-text 标题信息-->
						<h4 class="head-text text-left">添加仓库</h4>
					</div>
					<div class="modal-body">
						<form action="" class="form-horizontal" method="post">
					
							<div class="form-group">
								<span class="col-md-2 text-center margin-top">仓库名称：</span>
								<div class="col-md-9">
									<input type="text" class="form-control storadeName" name="storadeName" id="" value="" />
								</div>
							</div>
							<div class="form-group">
								<span class="col-md-2 text-center margin-top">仓库地址：</span>
								<div class="col-md-9">
									<input type="text" class="form-control storadeAdress" name="storadeAdress" id="" value="" />
								</div>
							</div>
							<div class="form-group">
								<span class="col-md-2 text-center margin-top">仓库类型：</span>
								<div class="col-md-6">
									<select class="form-control testselect classifyId" name="classifyId">
										<option value="0">请选择货物类型</option>
									</select>
								</div>
							</div>
							<div class="form-group">
								<span class="col-md-2 text-center margin-top">管理员：</span>
								<div class="col-md-6">
									<select class="form-control testselect userId" name="userId">
										<option value="0">请选择管理人员</option>
									
									</select>
								</div>
							</div>
						
							<div class="form-group">
								<span class="col-md-2 text-center margin-top">货区数量：</span>
								<div class="col-md-6">
									<input type="text" class="form-control rackCount" name="rackCount" id="" value="" />
								</div>
								<span class="col-md-2 margin-top color-hui2 text-size">1-10</span>
							</div>
						
					</div>
					<div class="modal-footer">
						<button class="btn btn-default" data-dismiss="modal">关闭</button>
						<input type="button" value="保存" class="btn btn-primary addlist"/>
					</div>
					</form>
				</div>
			</div>
		</div>

		<!--模态框-->
		<!-- 修改模态框-->
		<div class="modal fade mymodal">
			<div class="modal-dialog modal-lg">
				<div class="modal-content">
					<div class="modal-header">
						<button class="close" data-dismiss="modal">&times;</button>
						<!--head-text 标题信息-->
						<h4 class="head-text text-left">订单详情</h4>
					</div>
					<div class="modal-body">
						<form action="" class="form-horizontal update" method="post">
						<input type="hidden" class="form-control orderId" name="orderId" id="orderId" value="" />
						
							<div class="form-group">
								<span class="col-md-2 text-center margin-top">用户姓名：</span>
								<div class="col-md-9">
									<input type="text" class="form-control storadeName" name="storadeName" id="userName" value="" />
								</div>
							</div>
							<div class="form-group">
								<span class="col-md-2 text-center margin-top">汽车类型：</span>
								<div class="col-md-9">
									<input type="text" class="form-control storadeAdress" name="storadeAdress" id="carName" value="" />
								</div>
							</div>
							<div class="form-group">
								<span class="col-md-2 text-center margin-top">订单状态：</span>
								<div class="col-md-9">
									<input type="text" class="form-control storadeAdress" name="storadeAdress" id="orderTypes" value="" />
								</div>
							</div>
							<div class="form-group">
								<span class="col-md-2 text-center margin-top">取车时间：</span>
								<div class="col-md-9">
									<input type="text" class="form-control storadeAdress" name="storadeAdress" id="vehucleTakingTime" value="" />
								</div>
							</div>
							<div class="form-group">
								<span class="col-md-2 text-center margin-top">预定还车时间：</span>
								<div class="col-md-9">
									<input type="text" class="form-control storadeAdress" name="storadeAdress" id="returnTime" value="" />
								</div>
							</div>
							<div class="form-group">
								<span class="col-md-2 text-center margin-top">实际还车时间：</span>
								<div class="col-md-9">
									<input type="text" class="form-control storadeAdress" name="storadeAdress" id="actualTransferTime" value="" />
								</div>
							</div>
							<div class="form-group">
								<span class="col-md-2 text-center margin-top">订单时间：</span>
								<div class="col-md-9">
									<input type="text" class="form-control storadeAdress" name="storadeAdress" id="orderDate" value="" />
								</div>
							</div>
							<div class="form-group">
								<span class="col-md-2 text-center margin-top">取车地点：</span>
								<div class="col-md-9">
									<input type="text" class="form-control storadeAdress" name="storadeAdress" id="theCarStoresss" value="" />
								</div>
							</div>
							<div class="form-group">
								<span class="col-md-2 text-center margin-top">还车地点：</span>
								<div class="col-md-9">
								
									<input type="text" class="form-control storadeAdress" name="storadeAdress" id="theCarStoress" value="" />
								</div>
							</div>
						 
							</form>
					</div>
				
					<div class="modal-footer">
						<button class="btn btn-default" data-dismiss="modal">关闭</button>
						<shiro:hasPermission name="dept_update">
						<input type="hidden" value="还车" class="btn btn-primary updatelist" data-toggle="modal" data-target="#modal-zhifu" data-backdrop="static"/>
						</shiro:hasPermission>
					</div>
					
				</div>
			</div>
		</div>
				<!-- 支付页面   -->
	<div id="modal-zhifu" class="modal fade">
			<div class="modal-dialog modal-lg">
				<div class="modal-content">
					<div class="modal-header">
						<button class="close" data-dismiss="modal">&times;</button>
						<!--head-text 标题信息-->
						<h4 class="head-text text-left">支付信息</h4>
					</div>
					<div class="modal-body">
						<form action="" class="form-horizontal update" method="post">
							<input type="hidden" class="input_orderId" name="orderId" id="orderId" value=""/>
							<div class="form-group">
								<span class="col-md-2 text-center margin-top">预计还车时间:</span>
								<div class="col-md-9">
									<input type="text" class="form-control " name="" id="qucheDate" value=""  readonly="readonly"/>
								</div>
							</div>
							<div class="form-group">
								<span class="col-md-2 text-center margin-top">实际还车时间:</span>
								<div class="col-md-9">
									<input type="text" class="form-control " name="" id="huancheDate" value="" readonly="readonly" />
								</div>
							</div>
							<div class="form-group">
								<span class="col-md-2 text-center margin-top">逾期天数:</span>
								<div class="col-md-9">
									<input type="text" class="form-control " name="" id="tuqiTime" value="" readonly="readonly" />
								</div>
							</div>
							<div class="form-group">
								<span class="col-md-2 text-center margin-top">车辆租金:</span>
								<div class="col-md-9">
									<input type="text" class="form-control " name="" id="danjia" value=""  readonly="readonly"/>
								</div>
							</div>
							<div class="form-group">
								<span class="col-md-2 text-center margin-top">车辆行程(公里):</span>
								<div class="col-md-9">
									<input type="text" class="form-control limitThe " name="" id="limitThe" value="" />
								</div>
							</div>
							
							<div class="form-group">
								<span class="col-md-2 text-center margin-top">需付金额:</span>
								<div class="col-md-9">
									<input type="text" class="form-control " name="" id="price" value=""  readonly="readonly"/>
								</div>
							</div>
						</form>
						
					</div>
						
					<div class="modal-footer">
						<div style="text-align:left;display:inline;">
							<span style="color:red;">需要申请维修吗？</span>
							<button type="button" class="btn btn-warning weixiu"  data-toggle="modal" data-target="#modal-weixiu" data-backdrop="static">申请维修</button>
						</div>
						<div style="display:inline;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						</div>
						<div style="display:inline;">
						<button class="btn btn-default" data-dismiss="modal">取消</button>
						<input type="button" value="完成" class="btn btn-primary updatahuanche"/>		
						</div>
					</div>
					
				</div>
			</div>
		</div>
		<!--維修報表  -->
		<div id="modal-weixiu" class="modal fade">
			<div class="modal-dialog modal-lg">
				<div class="modal-content">
					<div class="modal-header">
						<button class="close" data-dismiss="modal">&times;</button>
						<!--head-text 标题信息-->
						<h4 class="head-text text-left">维修信息</h4>
					</div>
					<div class="modal-body">
						<form action="" class="form-horizontal weixiuinfo" method="post">
							<input type="hidden" class="input_orderId" name="orderId" id="orderId" value=""/>
							<div class="form-group">
								<span class="col-md-2 text-center margin-top">维修车辆编号:</span>
								<div class="col-md-9">
									<input type="text" class="form-control " name="carId" id="carId" value=""  readonly="readonly" />
								</div>
							</div>
							<div class="form-group">
								<span class="col-md-2 text-center margin-top">维修原因：</span>
								<div class="col-md-9">
									<input type="text" class="form-control " name="servicingreason" id="servivingreason" value=""  />
								</div>
							</div>
							<div class="form-group">
								<span class="col-md-2 text-center margin-top">维修费用：</span>
								<div class="col-md-9">
									<input type="text" class="form-control " name="servicingprice" id="servicingprice" value=""  />
								</div>
							</div>
							<div class="form-group">
								<span class="col-md-2 text-center margin-top">维修时间：</span>
								<div class="col-md-9">
									<input type="text" class="form-control " name="servicingdate" id="servicingdate" value=""  />
								</div>
							</div>
							</form>
							
					</div>
					<div class="modal-footer">
					    
						<button class="btn btn-default" data-dismiss="modal">取消</button>
						<input type="button" value="完成" class="btn btn-primary wancheng"/>
					</div>
					
				</div>
			</div>
		</div>
		<!--模态框-->
			<script type="text/javascript " 
		src="/js/jquery-3.2.1.js "></script>
		<script type="text/javascript" src="/js/cityTo.js"></script>
	<script type="text/javascript "
		src="/js/bootstrap.js "></script>
		
		<script type="text/javascript">
			$(function() {
				$(".chaxun").click(function(){
					var id=$(".shuruid").val();
					var sel= $(".testselect option:selected");
					var types=sel.val();
					if(types=="0"){
						types="1";
					}
					if(id==""){
						alert("查询值不能为空或输入有效的ID")
						return false;
					}else{
						$.ajax({
							"url" :"/chaxun",
							"type" : "post",
							"data" : {"types":types,"id":id} ,
							"dataType" : "json",
							success : function(data) {
								if(data==null){
									$("#tbodys").html("");
									$("#tbodys").append('<td>'+没有找到相关数据+'</td>')
								}else{
								$("#tbodys").html("");
								var state ;
								var ordertype=data.orderType;
								if(ordertype=="0"){
									state="普通车";
								}else{
									state="顺风车";
								}
								$("#tbodys").append('<tr><td>'+data.orderId+' </td> <td>'+data.userName+' </td><td>'+data.vehicleBrandName+' </td><td>'+myFunction(data.vehicleTakingTime)+' </td><td>'+myFunction(data.returnTime)+' </td><td>'+myFunction(data.actualTransferTime)+' </td><td class="orderType">'+state+' </td><td>'+myFunction(data.orderDate)+' </td><td class="valueName">'+data.valueName+' </td><td class="storadeId"> <span class="glyphicon glyphicon-edit bianji" data-toggle="modal" data-target=".mymodal" data-backdrop='+data.orderId+' data-state='+data.orderType+'></span> &nbsp;<a href="javaScript:;"><span class="glyphicon glyphicon-remove color-red "></span></a> <input type="hidden" class="carId" value='+data.orderId+'/></td></tr>');
								$(".bianji").on("click",function(){
									$(".updatelist").attr("type","hidden");
									var orderType=$(this).parents("tr").find(".orderType").html();
									var valueName=$(this).parents("tr").find(".valueName").html();
									if($.trim(orderType)=="普通车"&& $.trim(valueName)=="预定成功"){
										$(".updatelist").attr("type","button");
									}
									var that = $(this);
									var body = $(".modal-content");
									body.addClass().css("height","600px");
									var bodys = $(".modal-body");
									bodys.addClass().css("height","450px");
									var from =$(".form-horizontal");
									from.addClass().css("height","350px");
									var orderId= that.attr("data-backdrop");
									var orderstate = that.attr("data-state");
									$.ajax({
										"url" : "selectorderId",
										"type" : "get",
										"data" : {
											"orderId":orderId,
											"orderstate":orderstate
										},
										"dataType" : "json",
										success : function(data) {
											if(data.orderId==null){
										
											}else{
												$(".mymodal").find("#orderId").val(data.orderId);
											}
											
											$(".mymodal").find("#userName").val(data.userName);
											$(".mymodal").find("#carName").val(data.vehicleBrandName);
											$(".mymodal").find("#orderTypes").val(data.valueName);
											$(".mymodal").find("#vehucleTakingTime").val(myFunction(data.vehicleTakingTime));
											$(".mymodal").find("#returnTime").val(myFunction(data.returnTime));
											$(".mymodal").find("#actualTransferTime").val(myFunction(data.actualTransferTime));
											$(".mymodal").find("#orderDate").val(myFunction(data.orderDate));
											if(data.theCarStores!=null ){
												$(".mymodal").find("#theCarStoress").val(data.theCarStores);
											}else{
												$(".mymodal").find("#theCarStoress").val(data.pickUpDetail);
											}
											
											if(data.theDoorPoint!=null ){
												$(".mymodal").find("#theCarStoresss").val(data.theDoorPoint);
											}else{
												$(".mymodal").find("#theCarStoresss").val(data.returnDetail);
											}
											
										},
										error : function(data){
											if(data==null){
												alert("BUG 往往 隐藏的很深！！！");
											}
										}
									})
								})
							}
						},
						error:function(data){
						
							$("#tbodys").html("");
							$("#tbodys").append('<tr><td colspan="10">没有找到相关数据</td></tr>');
						}
							
						})
					}
					
				})
				
				$(".wancheng").click(function(){
					var servicing= $(".weixiuinfo").serialize()
					$.ajax({
						"url" :"weixiu",
						"type" : "post",
						"data" : servicing ,
						"dataType" : "json",
						success : function(data) {
							if(data>0){
								window.alert("添加成功");
							
							}
							else{
								window.alert("添加失败");
								
							}
						}
					})
				})
				
				$(".weixiu").click(function(){
					var carId = $(".carId").val();
					$("#carId").val(carId);
					var now = new Date(); 
					servicingdate.value=new Date().getFullYear() + '-' + (new Date().getMonth() + 1) + '-' + new Date().getDate(); 
					
				})
				$(".weixiu").addClass().css("text-align","left");
				/* <!-- <span>预计还车时间:</span><span id="qucheDate">1233</span></br>
				<span>实际还车时间:</span><span id="huancheDate">1233</span></br>
				<span>逾期天数:</span><span id="tuqiTime">1233</span></br>
				<span>车辆租金:</span><span id="danjia">1233</span></br>
				<span>需付金额:</span><span id="price">1233</span></br> --> */
				$(".qiehuan").bind("click",function(){
					var sel= $(".testselect option:selected");
					var types=sel.val();
					if(types=="0"){
						types="1";
					}
					location.href="/Carrentalorderform?types="+types;
				})
				/* 修改 */
			
				/*添加*/
				$(".bianji").on("click",function(){
					$(".updatelist").attr("type","hidden");
					var orderType=$(this).parents("tr").find(".orderType").html();
					var valueName=$(this).parents("tr").find(".valueName").html();
					if($.trim(orderType)=="普通车"&& $.trim(valueName)=="预定成功"){
						$(".updatelist").attr("type","button");
					}
					var that = $(this);
					var body = $(".modal-content");
					body.addClass().css("height","600px");
					var bodys = $(".modal-body");
					bodys.addClass().css("height","450px");
					var from =$(".form-horizontal");
					from.addClass().css("height","350px");
					var orderId= that.attr("data-backdrop");
					var orderstate = that.attr("data-state");
					$.ajax({
						"url" : "selectorderId",
						"type" : "get",
						"data" : {
							"orderId":orderId,
							"orderstate":orderstate
						},
						"dataType" : "json",
						success : function(data) {
							if(data.orderId==null){
								
							}else{
								$(".mymodal").find("#orderId").val(data.orderId);
							}
							
							$(".mymodal").find("#userName").val(data.userName);
							$(".mymodal").find("#carName").val(data.vehicleBrandName);
							$(".mymodal").find("#orderTypes").val(data.valueName);
							$(".mymodal").find("#vehucleTakingTime").val(myFunction(data.vehicleTakingTime));
							$(".mymodal").find("#returnTime").val(myFunction(data.returnTime));
							$(".mymodal").find("#actualTransferTime").val(myFunction(data.actualTransferTime));
							$(".mymodal").find("#orderDate").val(myFunction(data.orderDate));
							if(data.theCarStores!=null ){
								$(".mymodal").find("#theCarStoress").val(data.theCarStores);
							}else{
								$(".mymodal").find("#theCarStoress").val(data.pickUpDetail);
							}
							
							if(data.theDoorPoint!=null ){
								$(".mymodal").find("#theCarStoresss").val(data.theDoorPoint);
							}else{
								$(".mymodal").find("#theCarStoresss").val(data.returnDetail);
							}
							
						},
						error : function(data){
							if(data==null){
								alert("BUG 往往 隐藏的很深！！！");
							}
						}
					})
				})
				
				 $(".addlist").click(function(){
					var storadeName=$("#modal-add .storadeName").val();
					var userId=$("#modal-add .userId").val();
					var classifyId=$("#modal-add .classifyId").val();   
					var storadeAdress=$("#modal-add .storadeAdress").val();
					var rackCount=$("#modal-add .rackCount").val();
					$.ajax({
						"url" : cxt + "/house/addlists",
						"type" : "get",
						"data" : {
							"storadeName" : storadeName,
							"userId" : userId,
							"classifyId" : classifyId,
							"storadeAdress" : storadeAdress,
							"rackCount" : rackCount
						},
						"dataType" : "json",
						success : function(data) {
							if(data>0){
								window.alert("添加成功");
								location.href=cxt+"/house/tostorehouseList";
							}
							else{
								window.alert("添加失败");
								location.href=cxt+"/house/tostorehouseList";
							}
						}
					})
				}) 
				
				
				$(".updatelist").bind("click",function(){
					var orderId = $("#orderId").val();
					$(".input_orderId").val(orderId);
					var retus = $("#returnTime").val();
					$("#qucheDate").val(retus);
					function getNow(s) {
					    return s < 10 ? '0' + s: s;
					}

					var myDate = new Date();
					//获取当前年
					var year=myDate.getFullYear();
					//获取当前月
					var month=myDate.getMonth()+1;
					//获取当前日
					var date=myDate.getDate(); 
					var h=myDate.getHours();       //获取当前小时数(0-23)
					var m=myDate.getMinutes();     //获取当前分钟数(0-59)
					var s=myDate.getSeconds();  

					var now=year+'-'+getNow(month)+"-"+getNow(date)+" "+getNow(h)+':'+getNow(m)+":"+getNow(s);
					$("#huancheDate").val(now);
					var carId = $(".carId").val();
					$.ajax({
						"url":"/selectTheRent",
						"type":"get",
						"data":{"carId":carId},
						"dataType":"json",
						success:function(data){
							$("#danjia").val(data.theRent);
							var yujiTime = retus.substring(0,10);
							var shijiTime = now.substring(0,10);
							var tian = ( Math.abs( Date.parse(shijiTime)-Date.parse(yujiTime)) )/(1000 * 3600 * 24);
							$("#tuqiTime").val(tian);
							var price = parseInt(tian) * parseInt( data.theRent);
							$("#price").val(price);
						},
						error : function(data){
							if(data==null){
								alert("BUG 往往 隐藏的很深！！！");
							}
						}
					})
				})
				$(".updatahuanche").click(function(){
					var limitThe = $(".limitThe").val();
					if(limitThe==null){
						alert("车辆行程必须大于零！！！")
					}else{
						var orderIds=$(".input_orderId").val();
						var orderId= orderIds;
						$.ajax({
							"url" : "/updateOrderState",
							"type" : "get",
							"data" :{"orderId":orderId,"limitThe":limitThe },
							"dataType" : "json",
							success : function(data) {                                                    
								if(data>0){
									window.alert("修改成功");
									location.href="Carrentalorderform?types=1";
								}
								else{
									window.alert("修改失败");
									location.href="Carrentalorderform?types=1";
								}
							}
						})
					}
				})
				
				$(".glyphicon-remove").click(function(){
					var storeid=$(this).parents("tr").find(".storadeId").text();
					$.ajax({
						"url" : cxt + "/house/dellists",
						"type" : "get",
						"data" : {"storadeId":storeid}
						,
						"dataType" : "json",
						success : function(data) {
							if(data>0){
								
								window.alert("删除成功");
								location.href=cxt+"/house/tostorehouseList";
							}
							else if(data==0){
								window.alert("该仓库还有货物未处理");
								location.href=cxt+"/house/tostorehouseList";
							}
							else{
								window.alert("删除失败");
								location.href=cxt+"/house/tostorehouseList";
							}
						},
						error:function(data){
							window.alert("删除异常");
							location.href=cxt+"/house/tostorehouseList";
						}
					})
				})
			})
		</script>
	</body>

</html>